<?php

namespace haibao\weixin\data;

class WeixinArticle extends \haibao\weixin\data\BaseMysql{
	public function __construct() {
		parent::__construct ( '\haibao\weixin\model\data\weixinarticle' );
	}
	
	public function getTitleByObjectIds($objectIds,$objectId,$weixinInfoId){
		$str = implode(',',$objectIds);
		$str = preg_replace('/(\d+)/','%s',$str);
		$sql = 'SELECT ArticleId,Title FROM WeixinArticle WHERE ArticleId in ('.$str.') and Status=1 and ObjectType=%s and WeixinInfoId=%s';
		$objectIds[] = $objectId;
		$objectIds[] = $weixinInfoId;
		$result = $this->query($sql,$objectIds);
		$titleList = array();
		if($result){
			while($result->fetch_assoc()){
				$titleList[$result->getData('ArticleId')] = $result->getData('Title');
			}
		}
		
		return $titleList;
	}
}